//
//  MusicWebViewViewController.m
//  product_B
//
//  Created by zyc on 16/5/30.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "MusicWebViewViewController.h"

@interface MusicWebViewViewController ()
@property (nonatomic, strong)UIWebView *webView;
@end

@implementation MusicWebViewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = _name;
    self.navigationController.navigationBar.translucent = NO;
    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
//    _webView.backgroundColor = [UIColor redColor];
    NSString *urlString = [NSString stringWithFormat:@"http://m.wufazhuce.com/music/%@",_myID];
    NSString *string = [[NSString alloc]initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]] encoding:NSUTF8StringEncoding];
//    string = [string stringByReplacingOccurrencesOfString:@"<div class=\"music-player\">" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"<input type=\"button\" data-role=\"none\" class=\"play-btn\"" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"id=\"music-play-btn\" />" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"<p class=\"current-time\" id=\"music-current-time\">00:00</p>" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"<p class=\"total-time\" id=\"music-total-time\"></p>" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"<input type=\"range\" name=\"music-process\" id=\"music-process\"" withString:@""];
//    string = [string stringByReplacingOccurrencesOfString:@"data-highlight=\"true\" data-mini=\"true\" min=\"0\" max=\"100\" value=\"0\">" withString:@""];
    string = [string stringByReplacingOccurrencesOfString:@"<img alt=\"「ONE · 一个」\" class=\"logo-img\"" withString:@""];
    string = [string stringByReplacingOccurrencesOfString:@"src=\"http://image.wufazhuce.com/m.wufazhuce.com-download-guide.png\" />" withString:@""];
    string = [string stringByReplacingOccurrencesOfString:@"<a href=\"http://m.wufazhuce.com/download\" class=\"ui-btn ui-corner-all download-btn\"" withString:@""];
    string = [string stringByReplacingOccurrencesOfString:@"data-inline=\"true\" data-ajax=\"false\" target=\"_top\">点击下载ONE客户端</a>" withString:@""];
    string = [string stringByReplacingOccurrencesOfString:@"<p>立刻安装全新ONE 3.0参与讨论</p>" withString:@""];
    [_webView loadHTMLString:string baseURL:nil];
//    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
    [self.view addSubview:_webView];
    
    
    UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)];
    self.navigationItem.leftBarButtonItem = back;
}




- (void)backAction:(UIBarButtonItem *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
